Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free the image resource when the owner is deallocated #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tsnorri
Copy link

@tsnorri tsnorri commented May 31, 2018

No description provided.

Copy link

@mahagr mahagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. Destruct will remove the reference from the resource and free it in GC anyway.

public function __destruct()
{
if (null !== $this->resource)
imagedestroy($this->resource);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot recommend using imagedestroy() as the resource may have been used elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants